<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-商品列表">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span>文章管理 <span class="c-gray en">&gt;</span>公告列表<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form method="post" name="query_order_form"  id="query_order" action="${contextPath}/notice/notice_list" >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />                       
    <div class="text-c">
         <table class="table">
                <tr>
                    <td  style="text-align: right;">标题 ：</td>
                    <td>
                        <input id="title" value="${noticeQo.title}" class="input-text  radius" style="width:250px" placeholder="" name="title" type="text" value="${noticeQo.content}"/>
                    </td>
              		 
            	   
                    <td  style="text-align: right;">日期范围：</td>
                    <td>
                        <input type="text" value="<#if noticeQo.cdateStart?? >${noticeQo.cdateStart?date}</#if>"   onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}',readOnly : true })" id="datemin" name="cdateStart" class="input-text Wdate" style="width:120px;" >
                        -
                        <input type="text" value="<#if noticeQo.cdateEnd?? >${noticeQo.cdateEnd?date}</#if>"  onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' ,readOnly : true})" id="datemax" name="cdateEnd" class="input-text Wdate" style="width:120px;">
                    </td>
            
            		
                    
                </tr>
                <tr>
                
                <td  style="text-align: right;">公告状态 ：</td>
                    <td >
                        <select id="chooseStatus"   name="status" >
                        	<option value="">--请选择状态--</option>
                        	<#if   statusMap??>
                        	  <#list statusMap?keys as key>
                 				 <option value="${key}" <#if key==noticeQo.status > selected="selected"</#if> >${statusMap["${key}"]}</option> 
          					 </#list>
						 
							
							</#if>
                        </select>
                    </td>	
                     <td  style="text-align: right;">公告类型 ：</td>
                    <td>
                        <select id="chooseStatus"  name="type" >
                        	<option value="">--请选择类型 --</option>
                        	<#if   dictionaryMap??>
                        	  <#list dictionaryMap?keys as key>
                 				 <option value="${key}" <#if key==noticeQo.type > selected="selected"</#if> >${dictionaryMap["${key}"]}</option> 
          					 </#list>
						 
							</#if>
                        </select>
                    </td>
                </tr>
                 <tr>
                 	<td colspan="4" style="text-align: center;">
                 	 <button type="button" class="btn btn-success" onclick="search()" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
           			 <button type="button" class="btn btn-success"   onclick="toEmpty()" ><i class="Hui-iconfont">&#xe665;</i> 重置</button>
                	 </td>
              </tr>
            </table>
           
    </div>
    		     
</form>

    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
  
    
    <span class="r">共有数据：<strong> ${pagination.totalCount} </strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr   class="text-c">
            <!-- <th width="45px">
            <input  type="checkbox" id="selectAll" disabled="disabled" onclick="checkAll()"/>
            </th> -->
            <th >标题</th>
           
            <th >类型</th>
            <th >创建时间</th>
          	<th >状态</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
       <#if pagination.list?? && (pagination.list?size &gt; 0) >
        <#list pagination.list as msgs> 
        	 <tr class="text-c">
        	   	<td > ${msgs.title}  </td>
        	   	<td> 
        	    
					<#if msgs.sysDictionaryId?? && dictionaryMap??>
							${dictionaryMap[""+msgs.sysDictionaryId +""]}
					</#if>
        	   	 </td>
        	   	<td >
        	   		<#if msgs.createDate> ${msgs.createDate?datetime}</#if>
        	   </td>
        	   <td >
        	 
        	  <#if msgs.status?? && statusMap??>
							${statusMap[""+msgs.status+""]}
				</#if>
        	   </td>
        	  
        	  
        		<td>
        		 <#if msgs.status ==184>   <a title="审核" href="javascript:;"    onclick="showCheckleter(${msgs.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a></#if>
        		   <a title="删除" href="javascript:;"    onclick="del_result(${msgs.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
        		      <a title="编辑" href="javascript:;"    onclick="showEditleter(${msgs.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
        		    <a title="详情" href="javascript:;"    onclick="showSearchNotice(${msgs.id})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe665;</i></a>
        		</td>
        	 </tr>
      </#list>
      	 <tr> <td colspan="7" style="text-align: right;"> <button type="button" class="btn btn-success"   onclick="showAddleter()" ><i class="Hui-iconfont">&#xe600;</i> 添加</button>
                	</td></tr>
      </#if>
     </tbody>
    </table>
    <div id="biuuu_city" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>

<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/notice/notice_list.js"></script>
<script type="text/javascript">
var path="${contextPath}";

laypage({
    cont: 'biuuu_city',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
    skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
          $(page).val(obj.curr);//获取点击的页码
          $(query_order_form).submit();
        }
    }
})  



function showAddleter(){
var path = '${contextPath}'	;
   
     var index = layer.open({
    type: 2,
    title: '文章添加',
    scrollbar: false,
    content: path+"/notice/notice_add",
    area: [(document.body.clientWidth > 850 ? 850 : document.body.clientWidth) + "px", (document.body.clientHeight > 750 ? 710 : document.body.clientHeight - 40) + "px"]
    });  
     
    
}


function showEditleter(id){
var path = '${contextPath}'	;
   
     var index = layer.open({
    type: 2,
    title: '文章修改',
    scrollbar: false,
    content: path+"/notice/notice_edit_index?id="+id,
    area: [(document.body.clientWidth > 850 ? 850 : document.body.clientWidth) + "px", (document.body.clientHeight > 750 ? 710 : document.body.clientHeight - 40) + "px"]
    });  

    
}


function showCheckleter(id){
	var path = '${contextPath}'	;
	   
	     var index = layer.open({
	    type: 2,
	    title: '文章审核',
	    scrollbar: false,
	    content: path+"/notice/notice_check_index?id="+id,
	    area: [(document.body.clientWidth > 850 ? 850 : document.body.clientWidth) + "px", (document.body.clientHeight > 750 ? 710 : document.body.clientHeight - 40) + "px"]
	    });  

	    
	}
	


function showSearchNotice(id){
	var path = '${contextPath}'	;
	   
	     var index = layer.open({
	    type: 2,
	    title: '文章审核',
	    scrollbar: false,
	    content: path+"/notice/notice_search?id="+id,
	    area: [(document.body.clientWidth > 850 ? 850 : document.body.clientWidth) + "px", (document.body.clientHeight > 750 ? 710 : document.body.clientHeight - 40) + "px"]
	    });  

	    
	}	
function edit_result(id){
	var path = '${contextPath}'	;
	   
    var index = layer.open({
    type: 2,
    title: '站内信添加',
    scrollbar: false,
    content: path+"/letter/letter_edit_index?id="+id,
    area: [(document.body.clientWidth > 850 ? 850 : document.body.clientWidth) + "px", (document.body.clientHeight > 750 ? 710 : document.body.clientHeight - 40) + "px"]
    });
  
    
}


function send_result(id){
	var path = '${contextPath}'	;
	layer.confirm("是否发送信息？",function(){
		 var url = path+"/letter/letter_send" ;	
		$.ajax({
	 		url:url,
	 		data:{"id":id}, 
	 		type:"post",
	 		dataType:"text",
	 		success:function(message){
	 			
	 			if(message!="-1"){
	 				layer.msg("发送成功!" ,{icon:1,time:1500},function(){
	 					
	 					$("#query_order").submit();
	 				});
	 				
	 			}else{
	 				layer.msg('发送失败！',{icon:1,time:1000},function(){});
	 			}
	 			
	 		},
	 		error:function(){
	 			layer.msg('发送失败!',{icon:1,time:1000},function(){});
	 			$("#"+no).show();
	 		}
	 	});	
	});
}    



function del_result(id){
	layer.confirm("是否标记删除该记录？",function(){
		 var url = "${contextPath}/notice/notice_delete" ;	
		$.ajax({
	 		url:url,
	 		data:{"id":id}, 
	 		type:"post",
	 		dataType:"text",
	 		success:function(message){
	 			
	 			if(message!="-1"&&message=="1"){
	 				layer.msg("删除成功!" ,{icon:1,time:1500},function(){
	 					
	 					$("#query_order").submit();
	 				});
	 				
	 			}else if(message=="-1"){
	 				layer.msg('删除失败！',{icon:1,time:1000},function(){});
	 			}else{
	 				layer.msg('无权限操作！',{icon:1,time:1000},function(){});
	 			}
	 			
	 		},
	 		error:function(){
	 			layer.msg('删除失败!',{icon:1,time:1000},function(){});
	 			$("#"+no).show();
	 		}
	 	});	
	});
}    


</script>
</body>

</html>
 
